from django.shortcuts import render
from django.http import HttpResponse
# Create your views here.

def index_views(request):
    return render(request,'index.html')
def login_views(request):
    method =request.method
    print (method)
    if method =='GET':
        return render(request,'login.html')
    elif method =='POST':
        username =request.POST.get('username','')
        password =request.POST.get('password','')
        if username=='lisi' and password=='123':
            return render(request,'loginSucceed.html')
        else:
            return render(request, 'login.html')
    else:
        return HttpResponse('其他的请求方式')

def register_views(request):
    method = request.method
    print(method)
    if method == 'GET':
        return render(request, 'register.html')
    elif method == 'POST':
        password = request.POST.get('password', '')
        password1=request.POST.get('password1','')
        if password1==password:
            return render(request, 'registersucceed.html')
        else:
            return HttpResponse('两次密码不一致')
